package mf.com.Utils;

import mf.com.entity.system.SysUser;

/**
 * @Author: lmf
 * @Create: 2024/3/26 20:50
 * Description:  存储当前线程池变量(方便在同一线程操作)
 */
public class AuthContextUtil {
    // 创建 threadLocal 对象
    private static final ThreadLocal<SysUser> threadLocal = new ThreadLocal<>();

    // 添加数据
    public static void set(SysUser sysUser){
        threadLocal.set(sysUser);
    }

    // 获取数据
    public static SysUser get(){
        return threadLocal.get();
    }

    // 删除数据
    public static void remove(){
        threadLocal.remove();
    }
}
